package com.tuliyou.vo;
import com.tuliyou.entity.UniMajorEnrollment;
import jakarta.persistence.Id;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 院校专业招生数据VO（用于前后端交互，对应接口返回格式）
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UniMajorEnrollmentVO {

    @Id
    private Long id;

    private String universityCode;

    private String majorName;

    private Integer enrollYear;

    private String province;

    private String examType;

    private String educationLevel;

    private Integer minScore;

    private Integer minRank;

    private Integer planCount;

    private Integer actualCount;

    private String description;

    public static UniMajorEnrollmentVO fromUniMajorEnrollment(UniMajorEnrollment uniMajorEnrollment) {
        if(uniMajorEnrollment == null)
            return null;
        return new UniMajorEnrollmentVO(
                uniMajorEnrollment.getId(),
                uniMajorEnrollment.getUniversityCode(),
                uniMajorEnrollment.getMajorName(),
                uniMajorEnrollment.getEnrollYear(),
                uniMajorEnrollment.getProvince(),
                uniMajorEnrollment.getExamType(),
                uniMajorEnrollment.getEducationLevel(),
                uniMajorEnrollment.getMinScore(),
                uniMajorEnrollment.getMinRank(),
                uniMajorEnrollment.getPlanCount(),
                uniMajorEnrollment.getActualCount(),
                uniMajorEnrollment.getDescription()
        );
    }
}
